package com.hiv.mapper.domain;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 采样数据对象 sampling_record
 *
 * @author zhanghong
 * @date 2022-09-20
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("采样数据")
public class SamplingRecord implements Serializable {
    private Long id;
    @ApiModelProperty("抗病毒编码")
    private String antiviralCode;
    @ApiModelProperty("采样条形码")
    private String barCode;
    @ApiModelProperty("检验所id")
    private Long inspectionId;
    @ApiModelProperty("医院id")
    private Long hospitalId;
    @ApiModelProperty("类型 1病载含量检测 2耐药性检测 3病载&耐药检测")
    private Integer checkType;
    @ApiModelProperty("采样状态 0失败 1成功")
    private Integer samplingStatus;
    @ApiModelProperty("样品状态  0待送检 1入库正常 2样品破损 3额外样品 4其他异常 5待检测 6已完成 7检测中")
    private Integer sampleStatus;
    @ApiModelProperty("重采状态 0未重采 1已重采")
    private Integer resamplingStatus;
    @ApiModelProperty("采样员id")
    private Long samplerId;
    @ApiModelProperty("检测时样品状态 1样品正常 2样品异常")
    private Integer inspectionSamplingStatus;
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @ApiModelProperty("入库时间")
    private Date storageTime;
    @ApiModelProperty("入库员id")
    private Long storagerId;
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @ApiModelProperty("检测时间")
    private Date inspectionTime;
    @ApiModelProperty("检测员id")
    private Long inspectorId;
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @ApiModelProperty("检测完成时间")
    private Date finishTime;
    @ApiModelProperty("病载数据上传 0false 1true")
    private Boolean diseaseLoad;
    @ApiModelProperty("耐药数据上传 0false 1true")
    private Boolean drugResistance;
    @ApiModelProperty("完善状态 1待完善 2已提交")
    private Integer completeStatus;
    @ApiModelProperty("编制人id")
    private Long completeUser;
    @ApiModelProperty("审核状态 1待审核 2已通过 3已驳回")
    private Integer auditStatus;
    @ApiModelProperty("审核人id")
    private Long auditUser;
    @ApiModelProperty("批准状态 1待批准 2已批准")
    private Integer ratifyStatus;
    @ApiModelProperty("批准人id")
    private Long ratifyUser;
    @ApiModelProperty("批准日期")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    private Date ratifyTime;
    @ApiModelProperty("报告状态 1待生成 2已生成")
    private Integer reportStatus;
    @ApiModelProperty("基本信息-委托单位")
    private String baseEntrustUnit;
    @ApiModelProperty("基本信息-'基本信息-受检单位'")
    private String baseInspectionUnit;
    @ApiModelProperty("基本信息-'基本信息-单位地址'")
    private String baseUnitAddress;
    @ApiModelProperty("基本信息-'基本信息-单位邮箱'")
    private String baseUnitEmail;
    @ApiModelProperty("基本信息-'基本信息-单位电话'")
    private String baseUnitPhone;
    @ApiModelProperty("保存温度")
    private String storageTemperature;
    @ApiModelProperty("到样温度")
    private String receiveTemperature;
    @ApiModelProperty("声明信息-报告声明")
    private String reportInfo;
    @ApiModelProperty("样本信息-病载检测依据")
    private String symbolDiseaseInspectBasis;
    @ApiModelProperty("样本信息-耐药检测依据")
    private String symbolDrugInspectBasis;
    @ApiModelProperty("样本信息-病载检测设备")
    private String symbolDiseaseInspectDevice;
    @ApiModelProperty("样本信息-耐药检测设备")
    private String symbolDrugInspectDevice;
    @ApiModelProperty("样本信息-检测结论")
    private String symbolInspectResult;
    @ApiModelProperty("样本信息-其他备注")
    private String symbolRemark;
    @ApiModelProperty("整体备注-最终备注")
    private String lastRemark;
    @ApiModelProperty("病载报告pdf")
    private String diseasePdf;
    @ApiModelProperty("耐药报告pdf")
    private String drugPdf;
    @ApiModelProperty("病载报告编码")
    private String diseaseReportCode;
    @ApiModelProperty("耐药报告编码")
    private String drugReportCode;

    @ApiModelProperty("删除状态 0未删除 1已删除")
    private Integer deleted;
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @ApiModelProperty("更新时间")
    private Date updateTime;
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("+质控中心/医院/检验所名称")
    private String hospitalName;
    @ApiModelProperty("+采样员")
    private String samplerName;
    @ApiModelProperty("+入库员")
    private String storagerName;
    @ApiModelProperty("+检测员")
    private String inspectorName;
    @ApiModelProperty("+批次号")
    private String batchCode;
    @ApiModelProperty("+快递号")
    private String express;
    @ApiModelProperty("+耐药检测结果数据list")
    private List<JSONObject> drugResultList;
    @ApiModelProperty("+病载检测结果数据")
    private String diseaseResult;
    @ApiModelProperty("+病载检测含量数据")
    private Integer diseaseNum;
    @ApiModelProperty("编制人签名")
    private String completeUserSign;
    @ApiModelProperty("审核人签名")
    private String auditUserSign;
    @ApiModelProperty("批准人签名")
    private String ratifyUserSign;
    @ApiModelProperty("盒子编号")
    private String boxCode;

    @ApiModelProperty("+检验所logo")
    private String logo;
    @ApiModelProperty("+检验所电子章")
    private String electronicSeal;

    @ApiModelProperty("+耐药检测结果数据source list")
    private List<SamplingRecordResult> drugResultSourceList;

    @ApiModelProperty("+耐药检测结果数据source list")
    private List<SamplingRecordResult> drugResultPointList;

    /**
     * 是否是病载
     * @return
     */
    public boolean isDisease() {
        return checkType == 1;
    }
    /**
     * 是否是病载
     * @return
     */
    public boolean isDrug() {
        return checkType == 2;
    }
    /**
     * 是否是病载&耐药
     * @return
     */
    public boolean isDiseaseAndDrug() {
        return checkType == 3;
    }
}
